package com.czi.webrtctemp
import android.content.Context
import android.content.pm.PackageManager
import androidx.core.content.ContextCompat

object PermissionUtils {
    /**
     * 检查是否已授予所有权限
     * @param context Context
     * @param permissions 需要检查的权限数组
     * @return Boolean true表示所有权限都已授予
     */
    fun hasPermissions(context: Context, vararg permissions: String): Boolean {
        return permissions.all {
            ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED
        }
    }
}